import java.util.*;

class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        // code here
        int n = sc.nextInt();
        int count0 = 0, count1 = 0, count2 = 0; //取余 3 的余数
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
            int num = arr[i] % 3;
            if (num == 0) {
                count0++;
            } else if (num == 1) {
                count1++;
            } else {
                count2++;
            }
        }

        System.out.println(count0 / 2 + Math.min(count1, count2));

        sc.close();
    }
}